package com.mes.cloud.dao;

import com.mes.cloud.api.dto.request.employee.RolePageListRequest;
import com.mes.cloud.api.dto.request.role.EmployeePageListRequest;
import com.mes.cloud.entity.SysEmployeeRole;
import com.mes.cloud.entity.vo.employee.RoleVo;
import com.mes.cloud.entity.vo.role.EmployeeVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;

import java.util.List;

/**
 * 角色用户关联表
 *
 * @author wxm
 * @email xiaomin.wu1@pactera.com
 * @version 2019-08-02 15:02:43
 */
public interface SysEmployeeRoleDao  extends SelectByIdsMapper<SysEmployeeRole>, Mapper<SysEmployeeRole>{
    /**
     * 批量插入员工角色关系
     * @param sysEmployeeRoleList
     * @return
     */
    int batchInsert(List<SysEmployeeRole> sysEmployeeRoleList);

    /**
     * 批量删除员工角色关系
     * @param ids
     * @param updateDateStr
     * @param
     * @return
     */
    int batchDelete(@Param("list") List<String> ids,
                    @Param("updateDateStr") String updateDateStr,
                    @Param("employeeNo") String employeeNo,
                    @Param("employeeName") String employeeName);

    /**
     * 查询员工下的角色
     * @param rolePageListRequest
     * @return
     */
    List<RoleVo> rolePageList(RolePageListRequest rolePageListRequest);

    /**
     * 查询角色下员工
     * @param employeePageListPageRequest
     * @return
     */
    List<EmployeeVo> employeePageList(EmployeePageListRequest employeePageListPageRequest);

    /**
     * 更新员工的主要角色
     * @param employeeId
     * @return
     */
    int updateRoleMainFlag(@Param("employeeId") String employeeId);

    /**
     * 断开员工角色关系
     * @param employeeId
     * @param updateDateStr
     * @param employeeNo
     * @param employeeName
     * @return
     */
    int deleteByEmployee(@Param("employeeId") String employeeId,
                         @Param("updateDateStr") String updateDateStr,
                         @Param("employeeNo") String employeeNo,
                         @Param("employeeName") String employeeName);
}
